package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonContructSatisticsesBean;
import com.fancy.learncenter.bean.QuestionVOsBean;
import com.fancy.learncenter.ui.activity.CartoonStudentWorkDetailActivity;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;

import java.util.ArrayList;
import java.util.List;

/**
 * 作业报告--作业内容
 * Created by shiweiwei on 2018/1/26.
 */

public class TeacherReportContentAdapter extends CommonRecycleViewAdapter<CartoonContructSatisticsesBean> {

    public String getStudentHomeworkId() {
        return studentHomeworkId;
    }

    public void setStudentHomeworkId(String studentHomeworkId) {
        this.studentHomeworkId = studentHomeworkId;
    }

    public TeacherReportContentAdapter(Context mContext, List<CartoonContructSatisticsesBean> itemDatas) {
        super(mContext, R.layout.cartoon_homework_content_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final CartoonContructSatisticsesBean item, final int position) {

        TextView text_name = customViewHold.getView(R.id.text_name);
        TextView question_num_text = customViewHold.getView(R.id.question_num_text);
        if (!TextUtils.isEmpty(item.getConstructName())) {
            text_name.setText(item.getConstructName());
        }

        if (!TextUtils.isEmpty(item.getTotalNums())) {

        }
        question_num_text.setText(item.getTotalNums());

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, CartoonStudentWorkDetailActivity.class);
                intent.putExtra("studentHomeworkId", studentHomeworkId);
                ArrayList<String> ids = new ArrayList<>();
                for (int i = 0; i < item.getQuestionIds().size(); i++) {
                    ids.add(item.getQuestionIds().get(i) + "");
                }
                intent.putStringArrayListExtra("questionIds", ids);
                intent.putExtra("studentName", studentName);
                intent.putExtra("workName", item.getConstructName());
                intent.putExtra("accuracy", accuracy);

                intent.putParcelableArrayListExtra("questionVOs", questionVOs);
                mContext.startActivity(intent);
            }
        });
    }

    public String getStudentName() {
        return studentName;
    }


    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public String getAccuracy() {
        return accuracy;
    }

    public void setAccuracy(String accuracy) {
        this.accuracy = accuracy;
    }

    public String accuracy = "";
    public String studentName = "";
    public String right = "";

    public String getRight() {
        return right;
    }

    public void setRight(String right) {
        this.right = right;
    }

    public String studentHomeworkId = "";

    public ArrayList<QuestionVOsBean> getQuestionVOs() {
        return questionVOs;
    }

    public void setQuestionVOs(ArrayList<QuestionVOsBean> questionVOs) {
        this.questionVOs = questionVOs;
    }

    private ArrayList<QuestionVOsBean> questionVOs;
}
